<template>
  <div>
    <Header />
    <router-view></router-view>
    <!-- 方法一：计算属性 -->
    <!-- <Footer v-if="isHidden"/> -->

    <!-- 方法二：路由元信息 -->
    <Footer v-if="!$route.meta.isHidden"/>
  </div>
</template>

<script>
import Header from "@comp/Header";
import Footer from "@comp/Footer";
import { mapActions } from "vuex";
export default {
  name: "App",
  components: {
    Header,
    Footer,
  },
  computed: {
    // 方法一：
    //   计算属性：只有login路由和register路由没有Footer组件，可以利用当前路由的name属性，将这两个路由排除
    isHidden() {
      return this.$route.name !== "login" && this.$route.name !== "register";
    },
  },
  mounted(){
    // console.log(this);
    this.getCategoryListAsync();
  },
  methods:{
    ...mapActions("category", ["getCategoryListAsync"]),
  }
};
</script>

<style>
</style>